package com.example.servicetest.ui.clip_image

import android.graphics.Bitmap
import android.graphics.BitmapFactory
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import androidx.databinding.DataBindingUtil
import com.example.servicetest.R
import com.example.servicetest.databinding.ActivityClipImageBinding

class ClipImageActivity : AppCompatActivity() {

    lateinit var binding: ActivityClipImageBinding

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = DataBindingUtil.setContentView(this,R.layout.activity_clip_image)
        val mBgBitmap: Bitmap = BitmapFactory.decodeResource(resources, R.drawable.photo)
        binding.faceView.setScaleBitmap(mBgBitmap)
    }

    fun doClick(view: View) {
        when(view.id){

            R.id.btn1->{
                val mBgBitmap: Bitmap = BitmapFactory.decodeResource(resources, R.drawable.photo)
                binding.clipImageView.setScaleBitmap(mBgBitmap)
            }

//            R.id.btn2->{
//                binding.imageView.setImageBitmap(binding.clipImageView.saveCupImage())
//            }

        }
    }
}